//背景动画
function bgFlash(){
    var canvas = document.getElementById('bgFlash'),
        ctx = canvas.getContext('2d'),
        w = canvas.width = window.innerWidth,
        h = canvas.height = window.innerHeight,

        hue = 217,
        stars = [],
        count = 0,
        maxStars = 200;//星星数量

    var canvas2 = document.createElement('canvas'),
        ctx2 = canvas2.getContext('2d');

    canvas2.width = 100;
    canvas2.height = 100;

    var half = canvas2.width / 2, gradient2 = ctx2.createRadialGradient(half, half, 0, half, half, half);

    gradient2.addColorStop(0.025, '#CCC');
    gradient2.addColorStop(0.1, 'hsl(' + hue + ', 61%, 33%)');
    gradient2.addColorStop(0.25, 'hsl(' + hue + ', 64%, 6%)');
    gradient2.addColorStop(1, 'transparent');

    ctx2.fillStyle = gradient2;
    ctx2.beginPath();
    ctx2.arc(half, half, half, 0, Math.PI * 2);
    ctx2.fill();

// End cache

    function random(min, max) {
        if (arguments.length < 2) {
            max = min;
            min = 0;
        }

        if (min > max) {
            var hold = max;
            max = min;
            min = hold;
        }

        return Math.floor(Math.random() * (max - min + 1)) + min;
    }

    function maxOrbit(x, y) {
        var max = Math.max(x, y),
            diameter = Math.round(Math.sqrt(max * max + max * max));
        return diameter / 2;
        //星星移动范围，值越大范围越小，
    }

    var Star = function() {

        this.orbitRadius = random(maxOrbit(w, h));
        //星星大小
        this.radius = random(60, this.orbitRadius) / 20;
        this.orbitX = w / 2;
        this.orbitY = h / 2;
        this.timePassed = random(0, maxStars);
        //星星移动速度
        this.speed = random(this.orbitRadius) / 200000;
        this.alpha = random(2, 10) / 10;

        count++;
        stars[count] = this;
    };

    Star.prototype.draw = function() {
        var x = Math.sin(this.timePassed) * this.orbitRadius + this.orbitX,
            y = Math.cos(this.timePassed) * this.orbitRadius + this.orbitY,
            twinkle = random(10);

        if (twinkle === 1 && this.alpha > 0) {
            this.alpha -= 0.05;
        } else if (twinkle === 2 && this.alpha < 1) {
            this.alpha += 0.05;
        }

        ctx.globalAlpha = this.alpha;
        ctx.drawImage(canvas2, x - this.radius / 2, y - this.radius / 2, this.radius, this.radius);
        this.timePassed += this.speed;
    };

    for (var i = 0; i < maxStars; i++) {
        new Star();
    }

    function animation() {
        ctx.globalCompositeOperation = 'source-over';
        ctx.globalAlpha = 0.5; //尾巴
        ctx.fillStyle = 'hsla(' + hue + ', 64%, 6%, 2)';
        ctx.fillRect(0, 0, w, h);
        ctx.globalCompositeOperation = 'lighter';
        ctx.drawImage(img,0,0,w,h);
        for (var i = 1, l = stars.length; i < l; i++) {
            stars[i].draw();
        }

        requestAnimationFrame(animation);
    }

    animation();
}
var img = new Image();

img.onload = function () {
    bgFlash();
};
img.src = 'img/背景.png';

//数字滚动
;(function($, window, document) {
    "use strict";
    var defaults = {
        deVal: 0,       //传入值
        className:'dataNums',   //样式名称
        digit:8    //默认显示几位数字
    };
    function rollNum(obj, options){
        this.obj = obj;
        this.options = $.extend(defaults, options);
        this.init = function(){
             this.initHtml(obj,defaults);
        }
    }
    rollNum.prototype = {
        initHtml: function(obj,options){
            var strHtml = '<ul class="' + options.className + ' inrow">';
            var valLen = options.digit ||  (options.deVal + '').length;
            if(obj.find('.'+options.className).length <= 0){
                for(var i = 0; i<  valLen; i++){
                    strHtml += '<li class="dataOne "><div class="dataBoc"><div class="tt" t="38"><span class="num0">0</span> <span class="num1">1</span> <span class="num2">2</span> <span class="num3">3</span> <span class="num4">4</span><span class="num5">5</span> <span class="num6">6</span> <span class="num7">7</span> <span class="num8">8</span> <span class="num9">9</span><span class="num0">0</span> <span class="num1">1</span> <span class="num2">2</span> <span class="num3">3</span> <span class="num4">4</span><span class="num5">5</span> <span class="num6">6</span> <span class="num7">7</span> <span class="num8">8</span> <span class="num9">9</span></div></div></li>';
                }
                strHtml += '</ul>';
                obj.html(strHtml);
            }
              this.scroNum(obj, options);
        },
        scroNum: function(obj, options){
            var number = options.deVal;
			var $num_item = $(obj).find('.' + options.className).find('.tt');
            var h = $(obj).find('.dataBoc').height(); 
          
            $num_item.css('transition','all 2s ease-in-out');
            var numberStr = number.toString();
            if(numberStr.length <= $num_item.length - 1){
                var tempStr = '';
                for(var a = 0; a < $num_item.length - numberStr.length; a++){
                    tempStr += '0';
                }
                numberStr = tempStr + numberStr;
            }

            var numberArr = numberStr.split('');
            $num_item.each(function(i, item) {
                setTimeout(function(){
                    $num_item.eq(i).css('top',-parseInt(numberArr[i])*h - h*10 + 'px');
                },i*100)
            });
        }
    }
    $.fn.rollNum = function(options){
        var $that = this;
        var rollNumObj = new rollNum($that, options);
        rollNumObj.init();
    };
})(jQuery, window, document);



//水波百分比
function Percentage(box, options) {
    var defaults = {
        bgColor: 'rgba(93,185,255,0.5)',
        color: '#dbdbdb',
        fontSize: '20',
        num:'10',
    }; 
    var obj = $.extend({}, defaults, options);

    var canvas = box[0];
    var ctx = canvas.getContext('2d');

    //range控件信息
    var rangeValue = obj.num;
    var nowRange = 0; //用于做一个临时的range

    //画布属性
    var mW = 160;
    var mH = 160;
    var lineWidth = 4;
    var borderWidth = 8;

    canvas.width = mW;
    canvas.height = mH;

    canvas.style.width = 70+'px';
    canvas.style.height = 70+'px';

    //圆属性
    var r = mH / 2; //圆心
    var cR = r - 4 * lineWidth; //圆半径

    //Sin 曲线属性
    var sX = 0;
    var sY = mH / 2;
    var axisLength = mW; //轴长
    var waveWidth = 0.03; //波浪宽度,数越小越宽
    var waveHeight = 6; //波浪高度,数越大越高
    var speed = 0.06; //波浪速度，数越大速度越快
    var xOffset = 0; //波浪x偏移量

    ctx.lineWidth = lineWidth;

    //画圈函数
    var IsdrawCircled = false;
    var drawCircle = function () {

        ctx.beginPath(); 
        var gradient=ctx.createLinearGradient(0,0,0,170);
		gradient.addColorStop(0,"#5db9ff");
		gradient.addColorStop(0.5,"#5db9ff");
		gradient.addColorStop(1,"#0076f7");
        ctx.strokeStyle = gradient;
        ctx.arc(r, r, cR + borderWidth, 0, 2 * Math.PI);
        ctx.stroke();
        ctx.beginPath();
        ctx.arc(r, r, cR, 0, 2 * Math.PI);
        ctx.clip();

    };

    //画sin 曲线函数
    var drawSin = function (xOffset) {
        ctx.save();

        var points = []; //用于存放绘制Sin曲线的点

        ctx.beginPath();
        //在整个轴长上取点
        for (var x = sX; x < sX + axisLength; x += 20 / axisLength) {
            //此处坐标(x,y)的取点，依靠公式 “振幅高*sin(x*振幅宽 + 振幅偏移量)”
            var y = -Math.sin((sX + x) * waveWidth + xOffset+2);

            var dY = mH * (1 - nowRange / 100);

            points.push([x, dY + y * waveHeight]);
            ctx.lineTo(x, dY + y * waveHeight);
        }

        //封闭路径
        ctx.lineTo(axisLength, mH);
        ctx.lineTo(sX, mH);
        ctx.lineTo(points[0][0], points[0][1]);
        ctx.fillStyle = obj.bgColor;
        ctx.fill();

        ctx.restore();
    };

    var drawSin2 = function (xOffset) {
        ctx.save();

        var points = []; //用于存放绘制Sin曲线的点

        ctx.beginPath();
        //在整个轴长上取点
        for (var x = sX; x < sX + axisLength; x += 20 / axisLength) {
            //此处坐标(x,y)的取点，依靠公式 “振幅高*sin(x*振幅宽 + 振幅偏移量)”
            var y = -Math.sin((sX + x) * waveWidth + xOffset);

            var dY = mH * (1 - nowRange / 100);

            points.push([x, dY + y * waveHeight]);
            ctx.lineTo(x, dY + y * waveHeight);
        }

        //封闭路径
        ctx.lineTo(axisLength, mH);
        ctx.lineTo(sX, mH);
        ctx.lineTo(points[0][0], points[0][1]);
        var gradient=ctx.createLinearGradient(0,0,0,170);
		gradient.addColorStop(0,"#5db9ff");
		gradient.addColorStop(0.5,"#5db9ff");
		gradient.addColorStop(1,"#0076f7");
        ctx.fillStyle = gradient;
        ctx.fill();

        ctx.restore();
    };

    //写百分比文本函数
    var drawText = function () {
        ctx.save();

        var size = obj.fontSize;

        ctx.font = size + 'px Microsoft Yahei';
        ctx.textAlign = 'center';
        ctx.fillStyle = obj.color;
        ctx.fillText(~~nowRange + '%', r, r + size / 2);

        ctx.restore();
    };

    var render = function () {
        ctx.clearRect(0, 0, mW, mH);

        if (IsdrawCircled == false) {
            drawCircle();
        }

        if (nowRange <= rangeValue) {
            var tmp = 1;
            nowRange += tmp;
        }

        if (nowRange > rangeValue) {
            var tmp = 1;
            nowRange -= tmp;
        }

        drawSin(xOffset);
        drawSin2(xOffset);
        drawText();

        xOffset += speed;
        requestAnimationFrame(render);
    };

    render();

    //设置值
//  this.setValue = function (val) {
//      rangeValue = 10;
//     
//  }
}

//进度条
function ech_n_1(){
	var myChart = echarts.init(document.getElementById("ech_n_1"));
var category = [];
var topData = [11220];
var bottomData = [9372];
var outlineData = [20592];
var bodyMax = 20592;
var fillImg = 'img/jindu.png'
var bgImg = 'img/jindu-bg.png'
option = {
	 grid: [{
        top: 40,
        left: 10,
        right: 150
    }],
    xAxis: {
        show: false
    },
    yAxis: {
        data: category,
        show: false
    },
    series: [
        { // 背景图
            type: 'pictorialBar',
            symbol: 'image://'+ bgImg,
            symbolOffset: [-13, 0],
            symbolSize: ['115%','255%'],
            data: outlineData,
        }, 
        { // 蓝柱
            type: 'pictorialBar',
            symbol: 'image://'+ fillImg,
            symbolOffset: [0, '-150%'],
            symbolSize: ['100%','30%'],
            symbolClip: true,
            symbolBoundingData: bodyMax,
            data: topData,
            animationDelay: function(dataIndex, params) {
                return params.index * 30 * 1.1
            }
        }, 
        { // 红柱
        type: 'pictorialBar',
        symbol: 'image://'+ fillImg,
        symbolClip: true,
        symbolBoundingData: bodyMax,
        symbolOffset: [0, '340%'],
            itemStyle: {
                normal: {
                    barBorderRadius: 5,
                    color: '#ed3e6d'
                }
            },
            symbolSize: ['100%','30%'],
            data: bottomData, 
            animationDelay: function(dataIndex, params) {
                return params.index * 30 * 1.1
            }
        }
    ],
    animation: true
};
if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
	
}

//

function ech_n_2(){
	$.ajax({
        type: 'get',
        url: 'js/data1.json',//请求数据的地址
        dataType: "json",        //返回数据形式为json
        success: function (result) {	
    var myChart = echarts.init(document.getElementById("ech_n_2"));
	var data_dongtai = [{
	name: "直接答复",
	value: result.Data.zhijieHuifu
}, {
	name: "网络交办",
	value: result.Data.wangluoJiaoban
}];
var total = result.Data.total;
//for(var i = 0; i < data_dongtai.length; i++) {
//	total += data_dongtai[i].value;
//}
var labelFromatter = {
	normal: {
		color: "#5886f0",
		borderColor: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
			offset: 0,
			color: '#7fc5f1'
		}, {
			offset: 0.3,
			color: '#0485f5'
		}, {
			offset: 1,
			color: '#7fc5f1'
		}]),
		borderWidth: 4
	}
}
var radius = [47, 50];
var h = ['23%', '73%']
var w = ['50%', '50%']
var label_dongtai = [];
for(var i = 0; i < data_dongtai.length; i++) {
	label_dongtai.push(data_dongtai[i].name);
}

option = {
	series: []
};
for(var i = 0; i < data_dongtai.length; i++) {
	option.series.push({
		type: 'pie',
		center: [h[i], w[i]],
		radius: radius,
		hoverAnimation: false,
		label: {
			show: true,
			formatter: function(params) {
				var percent = 0;

				percent = ((params.value / total) * 100).toFixed(0);
				if(params.name !== '') {
					return '{white|' + percent + '%}';
				} else {
					return '';
				}

			},
			rich: {
				white: {
					fontSize: 18,
					color: 'white',
					padding: [4, 4, 15, 4]
				}
			},
			position: 'center'
		},
		x: '0%',
		itemStyle: labelFromatter,
		data: [{
			name: data_dongtai[i].name,
			value: data_dongtai[i].value,
		}, {
			name: '',
			value: total - data_dongtai[i].value,
			itemStyle: {
				normal: {
					label: {
						show: false
					},
					labelLine: {
						show: false
					},
					color: 'rgba(0,0,0,0)',
					borderColor: 'rgba(0,0,0,0)',
					borderWidth: 0
				}
			}
		}]
	},{
		center: [h[i], w[i]],
        "radius": [34, 36],
        "hoverAnimation": false,
        "type": "pie",
        "data": [{
            "value": 1,
            "label": {
                "normal": {
                    "show": false,
                    "position": "center"
                }
            },
            "labelLine": {
                "show": false
            },
            "itemStyle": {
                "normal": {
                    "color": "#1d75d3",
                },
            },
        }]
    
	}
	);
};

if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
        },
    });

}

//词云
function ech_n_3(){
				$.ajax({
        type: 'get',
        url: 'js/data.json',//请求数据的地址
        dataType: "json",        //返回数据形式为json
        success: function (result) {
var myChart = echarts.init(document.getElementById("ech_n_3"));
var app = {};
var scaleData = result.Data;
					var data = [];
					for(var i = 0; i < scaleData.length; i++) {
						data.push({
							value: scaleData[i].Total,
							name: scaleData[i].Name,
						});
					}
option = {
                tooltip: {},
                 visualMap: {
                 	show:false,
		            pieces: [{
		                gt: 0,
		                lte: 500,
		                color: 'rgba(255,255,255,0.3)'
		            }, {
		                gt: 500,
		                lte: 1500,
		                color: 'rgba(255,255,255,0.5)'
		            }, {
		                gt: 1500,
		                lte: 3000,
		                color: 'rgba(255,255,255,0.7)'
		            }, {
		                gt: 3000,
		                lte: 8000,
		                color: 'rgba(255,255,255,0.8)'
		            }, {
		                gt: 8000,
		                color: 'rgba(255,255,255,1)',
		            }],
		        },
                series: [ {
                    type: 'wordCloud',
                    gridSize: 12,//字体间隔
                    sizeRange: [12, 50],//字体大小范围
                    rotationRange: [0, 0],//旋转角度 
                    drawOutOfBound: false,
                    shape: 'rect',
                    width: '95%',
                    height: '85%',
                    textStyle: {
                        normal: {
                            color:'white'
                        },
                        emphasis: {
                            shadowBlur: 10,
                            shadowColor: '#333'
                        }
                    },
                    data:  data
                } ]
			};;

if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
        },
    });

}


function ech_n_4(){
var myChart = echarts.init(document.getElementById("ech_n_4"));

data1=["14","23","83","144","956","2898","3263","2394","1081","1733","2910","2992","2992"]

option = {
    color: ['#26f2ff'],
    tooltip: {
        trigger: 'axis', //按x轴显示
        show: true,
        axisPointer: {
            lineStyle: {
                color: 'rgba(255, 255, 255, 0.2)', 
            },
        },
        backgroundColor: 'rgba(255, 255, 255, 0.2)',
        textStyle: {
            align: 'left',
            fontSize: 12,
            color: '#fff',
        },
        extraCssText: 'box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.2)' //添加阴影
    },
    grid: {
        left: '6%',
        right: '3%',
        top: '25%',
        bottom: '10%',
    },
    legend: {
        show: true,
        icon: 'circle',
        right: 25,
        textStyle: {
            fontSize: 12,
            color: '#fff'
        },
    },
    xAxis: {
        show: true,
        type: 'category',
        boundaryGap: false,
        axisTick: {
            show: false
        },
        axisLine: {
            show: false,
            lineStyle: {
                color: '#fff',
            }
        },
        axisLabel:{
        	interval:1,
        	fontSize:16,
        },
        data: function getDate() {
    var date = [];
     var len = 13;
                while (len--) {
        var now = new Date();
        date.push([now.getHours()-len, '00'].join(':'));
                }
    return date;
}() 
    },
    yAxis: {
        show: true,
        max:4000,
        type: 'value',
        axisTick: {
            show: false
        },
        axisLine: {
            show: false,
            lineStyle: {
                color: 'none',
            }
        },
        splitLine: {
            show: true,
            lineStyle:{
            	color:'rgba(40,212,255,0.1)',
            	width:2
            }
        },
        splitArea:{
            show: true,
            areaStyle:{
                color:'rgba(20,57,118,0.3)'
            }
        }
    },
    series: [{
        name: '来电总量',
        type: 'line',
        symbol: 'none',
        areaStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,
                        color: 'rgba(39,197,255,1)'
                    }, {
                        offset: 1,
                        color: 'rgba(39,197,255,0)'

                    }])
                }
            
        },
        smooth: 0.5,
            symbol: 'circle',
            symbolSize: 5,
            lineStyle: {
                width: 3,
                type: 'solid',
            },
        data:data1
    }
    ]
};
if (option && typeof option === "object") {
    myChart.setOption(option, true);
}

}





function ech_n_5(){
var myChart = echarts.init(document.getElementById("ech_n_5"));
data1=["26458","30308","7139","7210","9389","27273","26383","28956","31257","30197","8171","10414","23856","23993","27720"]
data2=["17106","20252","3560","3409","4256","11629","12538","11932","13411","12510","3697","4176","11992","12080","12494"]
data3=["9352","10056","3579","3801","5133","15644","13845","17024","17846","17687","4474","6238","11864","11913","15226"]

option = {
    name: 'a',
    tooltip: {
        trigger: 'axis', //按x轴显示
        show: true,
        axisPointer: {
            lineStyle: {
                color: 'rgba(255, 255, 255, 0.2)', 
            },
        },
        backgroundColor: 'rgba(255, 255, 255, 0.2)',
        textStyle: {
            align: 'left',
            fontSize: 12,
            color: '#fff',
        },
        extraCssText: 'box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.2)' //添加阴影
    },
    color: ['#ffef4e', '#18f5ba', '#37b2f5'],
    grid: {
        left: '5.5%',
        right: '2%',
        top: '25%',
        bottom: '10%',
    },
    legend: {
        show: true,
        icon: 'circle',
        right: 30,
        textStyle: {
            fontSize: 12,
            color: '#fff'
        },
    },
    xAxis: {
        show: true,
        type: 'category',
        axisTick: {
            show: false
        },
        axisLine: {
            show: false,
            lineStyle: {
                color: '#fff',
            }
        },
        axisLabel:{
        	fontSize:16,
        },
            data: (function getDate() {
    var ras = new Date().getMonth();
    var res = new Date().getDay();
    var base = +new Date(ras,res);
    var oneDay = 24 * 3600 * 1000;
    var date = [];
    var data = [Math.random() * 300];


    for (var i = 0; i < 15; i++) {
        var now = new Date(base += oneDay);
        date.push([now.getMonth() + 3, now.getDate()].join('/'));
    }
    return date;
})() 
    },
    yAxis: {
        show: true,
        type: 'value',
        axisTick: {
            show: false
        },
        axisLine: {
            show: false,
            lineStyle: {
                color: 'none',
            }
        },
        splitLine: {
            show: true,
            lineStyle:{
            	color:'rgba(40,212,255,0.1)',
            	width:2
            }
        },
        splitArea:{
            show: true,
            areaStyle:{
                color:'rgba(20,57,118,0.3)'
            }
        }
    },
    series: [{
        name: '来电总量',
        type: 'line',
        symbol: 'none',
            symbol: 'circle',
            symbolSize: 5,
            lineStyle: {
                width: 3,
                type: 'solid',
            },
        data:data1
    }, {
        name: '人工接听',
        type: 'line',
        symbol: 'none',
            symbol: 'circle',
            symbolSize: 5,
            lineStyle: {
                width: 3,
                type: 'solid',
            },
        data:data2
    }, {
        name: '自动服务',
        type: 'line',
        symbol: 'none',
            symbol: 'circle',
            symbolSize: 5,
            lineStyle: {
                width: 3,
                type: 'solid',
            },
        data:data3
    }
    ]
};
if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
}


//交办信息柱形图
function ech_n1_1(){
	$.ajax({
				type: 'get',
				url: '复制(3)ajax.json', //请求数据的地址
				dataType: "json", //返回数据形式为json
				success: function(result) {
				var scaleData = result.Data;
				var Yiban = [];
				var Jinji = [];
				var Teji = [];
				var Yanqi = [];
				var name = [];
					for(var i = scaleData.length-1; i >0; i--) {
						var arr = scaleData[i].Arr;
						Yiban.push(arr.Yiban);
						Jinji.push(arr.Jinji);
						Teji.push(arr.Teji);
						Yanqi.push(arr.Yanqi);
						name.push(scaleData[i].Department);
					}
var myChart = echarts.init(document.getElementById("ech_n1_1"));
option = {
    grid: {
        left: '30%',
    },
    legend: {
        show: true,
        icon: 'circle',
        right: 30,
        textStyle: {
            fontSize: 12,
            color: '#fff'
        },
    },
    color: ['#0090ff', '#ffc652', '#ff8b52', '#e24f4f'],
    xAxis: [{
        type: 'value',
         axisTick: {
    	show: false
         },
        axisLine: {
    	show: false
        },
        splitLine:{
        	lineStyle:{
        		color:'rgba(82,110,169,0.4)'
        	}
        },
        axisLabel: {
                color: 'rgba(140,198,238,0.4)',
                fontSize: '14',
                fontFamily: 'DIN-Medium',
        },
        show: true
    }],
    yAxis: [{
         axisTick: {
    	show: false
         },
        axisLine: {
    	show: false
        },
        offset: '100',
        axisLabel: {
                color: '#8cc6ee',
                fontSize: '16',
				align: 'left',
        },
        data: name
    }],
    series: [{
            name: '一般',
            type: 'bar',
            stack: '总',
            barWidth: 10,
            itemStyle: {
                    normal: {
                        barBorderRadius: [30, 0, 0, 30],
                    }
              },
            data:Yiban
        },
        {
            name: '紧急',
            type: 'bar',
            stack: '总',
            barWidth: 10,
            data: Jinji
        },
        {
            name: '特急',
            type: 'bar',
            stack: '总',
            barWidth: 10,
            data: Teji
        },
        {
            name: '延期',
            type: 'bar',
            stack: '总',
            barWidth: 10,
            itemStyle: {
                    normal: {
                        barBorderRadius: [0, 30, 30, 0],
                    }
                },
            data: Yanqi
        }
    ]
};

					if(option && typeof option === "object") {
						myChart.setOption(option, true);
					}
				}	
			});
}


//交办信息环形图
function ech_n1_2(){
var myChart = echarts.init(document.getElementById("ech_n1_2"));
$.ajax({
				type: 'get',
				url: 'js/huan.json', //请求数据的地址
				dataType: "json", //返回数据形式为json
				success: function(result) {
					var scaleData = [];
					var data = result.Data
						scaleData.push(data.Yanqi);
						scaleData.push(data.Teji);
						scaleData.push(data.Jinji);
						scaleData.push(data.Yiban);

					var placeHolderStyle = {
						normal: {
							label: {
								show: false
							},
							labelLine: {
								show: false
							},
							color: 'rgba(0, 0, 0, 0)',
							borderColor: 'rgba(0, 0, 0, 0)',
							borderWidth: 0
						}
					};
					var TodayTotal = data.TodayTotal
					var data = [];
					var color = ['#e24f4f', '#ff8b52', '#ffc652', '#0090ff'];
					for(var i = 0; i < scaleData.length; i++) {
						data.push({
							value: scaleData[i],
							name: scaleData[i].name,
							itemStyle: {
								normal: {
									borderWidth: 5,
									borderColor: color[i],
								}
							}
						}, {
							value: TodayTotal/100*3,
							name: '',
							itemStyle: placeHolderStyle
						});
					}
					option = {
						tooltip: {
							show: false
						},
						legend: {
							show: false
						},
						toolbox: {
							show: false
						},
						series: {
							name: '',
							type: 'pie',
//							clockWise: false,
							radius: [75, 80],
							hoverAnimation: false,
							itemStyle: {
								normal: {
									label: {
										show: false,
//										position: 'outside',
//										color: '#ddd',
//										formatter: function(params) {
//											var percent = 0;
//											var total = 0;
//											for(var i = 0; i < scaleData.length; i++) {
//												total += scaleData[i].value;
//											}
//											percent = ((params.value / total) * 100).toFixed(0);
//											if(params.name !== '') {
//												return '{white|' + params.name + '}' +'\n' + '  {white|' + percent + '%}' + '\n' +'  {white|' +  params.value+ '}';
//											} else {
//												return '';
//											}
//										},
//										rich: {
//											white: {
//												color: '#ddd',
//												align: 'right',
//												padding: [0, 0]
//											}
//										}
									},
									labelLine: {
										show: false
									}
								}
							},
							data: data
						}
					};

					if(option && typeof option === "object") {
						myChart.setOption(option, true);
					}
				},

			});
}

//最多跑一次南丁格尔玫瑰图

function ech_n1_3(){
var myChart = echarts.init(document.getElementById("ech_n1_3"));
var scaleData = [{
        'name': '人社网上办事',
        'value': 460
    },
    {
        'name': '公积金提取',
        'value': 613
    },
    {
        'name': '人社办事指南',
        'value': 914
    },
    {
        'name': '公积金贷款',
        'value': 259
    },
    {
        'name': '公积金缴存',
        'value': 1020
    }
];
var color1 = ['#e1b530', '#56a623', '#6dfced', '#d62d29', '#fb7f24'];
var color2 = ['#ffea00', '#a1d847', '#00abfb', '#f66e73', '#ffc252'];
var data = [];
for (var i = 0; i < scaleData.length; i++) {
    data.push({
        value: scaleData[i].value,
        name: scaleData[i].name,
        itemStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(
                    2, 0, 0, 1, [{
                            offset: 0,
                            color: color1[i]
                        },
                        {
                            offset: 1,
                            color: color2[i]
                        }
                    ]
                )
                    }
                },
    label: {
                show: true,
                formatter: '{white|'+'{b}'+'}'+'\n'+'{a|{c}}',
                rich: {
                    white: {
                        color: 'rgba(221,221,221,0.7)',
                        fontSize:26,
                        fontWeight:'bold'
                    },
                    a:{
                        fontSize:29,
                        fontWeight:'bold',
                        color: color2[i],
                    },
                },
            },
    });
}
option = {
    series: [{
            radius : [40, 220],
            roseType : 'radius',
    name: '',
    type: 'pie',
    labelLine:{
        length:30,
        length2:100,
        lineStyle:{
            width:3
        }
    }, itemStyle: {
            normal: {
                shadowBlur: 15,
                shadowColor: 'rgba(255, 255, 255, 0.5)'
            }
        },
    data: data.sort(function (a, b) { return a.value - b.value})
}]
};
if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
}


//区县市效能指数

function ech_n1_4(){
var myChart = echarts.init(document.getElementById("ech_n1_4"));
var xData = ['西湖风景区','临安区','大江东','淳安县','高新区','经济开发区','西湖区','上城区','富阳区','余杭区','拱墅区','下城区'];
var yData = [189,1267,645,543,2099,1246,3846,1687,1838,7349,2490,2222];
var color = ['#f93c28','#feba26','#4cb70e','#d9d9fd','#d9d9fd','#d9d9fd','#d9d9fd','#d9d9fd','#d9d9fd'];
var Color = [
            '#00ffff', '#0bb7ff',
            '#00ffff', '#0bb7ff',
            '#00ffff', '#0bb7ff',
            '#00ffff', '#0bb7ff',
            '#00ffff', '#0bb7ff',
            '#00ffff', '#0bb7ff',
            '#00ffff', '#0bb7ff',
            '#00ffff', '#0bb7ff',
            '#00ffff', '#0bb7ff',
            '#3ff777', '#4cb70e', 
            '#f0e45a', '#feba26', 
            '#f93e61', '#f93c28'
];
option = {
    grid: {
        left: '3%',
        right: '3%',
        top: '7%',
    },
    xAxis: [{
        type: 'category',
        data: xData,
        axisLine: {
            show: false
        },
        splitLine: {
            show: false
        },
        axisTick: {
            show: false
        },
        axisLabel: {
            show: false,
        }
    }],
    yAxis: [{
            show: false
        },
        {
            show: false
        }
    ],
    
    series: [{
            name: '办理数',
            type: 'bar',
            barWidth: '30%',
            itemStyle: {
                normal: {
                    barBorderRadius: 3,
                    color: function(params) {
                        var colorList = [];
                        for (var i = 12; i > 0; i--) {
                            colorList.push({
                                type: 'bar',
                                y2:1,
                                colorStops: [{
                                    offset: 0,
                                    color: Color[i*2 - 2] // 0% 处的颜色
                                }, {
                                    offset: 1,
                                    color: Color[i*2 - 1] // 100% 处的颜色
                                }],
                                globalCoord: false, // 缺省为 false

                            });
                        }

                        return colorList[params.dataIndex]
                    },
                }
            },
            label: {
                normal: {
                    show: true,
                    position: "bottom",
                    formatter:'{b}' ,
                    textStyle: {
                        padding:[10,0,0,0],
                        fontSize: 15,
                        fontWeight:'bold',
                        color: color
                    }
                }
            },
            data: yData,
            zlevel: 11

        },
        {
            name: '背景',
            type: 'bar',
            barWidth: '30%',
            barGap: '-100%',
            data: [8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000],
            itemStyle: {
                normal: {
                    color: 'rgba(255,255,255,0.1)',
                    barBorderRadius: 3,
                }
            },
            zlevel: 9
        },

    ]
};
if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
}



////进度条
//
//$(function(){
//	//a 加载色，b 底色 , w 展示宽度，h 高度，ah 加载展示高度
//	var a="#01dcf3";
//	var b="rgba(255,255,255,0)";
//	var w="120px";
//	var ah="10px";
//	var h="12px";
//	var div=$(".div");//进度条要插入的地方
//	var barb=function(){
//		div.each(function(){
//			var width=$(this).attr('w');
//			var color=$(this).attr('a');
//			var barbox='<dl class="barbox"><dd class="barline"><div w="'+width+'" class="charts '+color+'" style="width:0px;"><d style="padding-left: 135px;"></d></div></dd></dl>';
//			$(this).append(barbox);
//		})
//	}
//	
//	var amimeat=function(){
//		$(".charts").each(function(i,item){
//			var wi=$(this).attr("w");
//			$(item).animate({width: wi+"%"},1000,function(){//一天内走完
////				$(this).children('d').html(wi+"");
//			});
//		});
//	}
//	var barbCss=function(a,b){
//		$(".barbox").css({
//			"height":h,
//			"line-height":"6px",
//			"text-align":"center",
//			"color":"#fff",
//		})
//		$(".barbox>dd").css({
//			"float":"left"
//		})	
//		$(".barline").css({
//			"width":w,
//			"background":b,
//			"height":h,
////			"overflow":"hidden",
//			"display":"inline",
//			"position":"relative",
//			"border-radius":"8px",
//			"border":" 1px solid #00ffff",
//		})
//		$(".barline>d").css({
//			"position":"absolute",
//			"top":"0px",
//		})
//		$(".charts").css({
//			"height":ah,
//			"width":"0px",
//			"margin-top":"1px",
//			"overflow":"hidden",
//			"border-radius":"8px"
//		})
//	}
//	barb();
//	amimeat();
//	barbCss(a,b);
//})
//



//滚动
// JavaScript Document
(function($) {
	$.fn.myScroll = function(options) {
		//默认配置
		var defaults = {
			speed: 150, //滚动速度,值越大速度越慢
			// rowHeight: 24 //每行的高度
		};

		var opts = $.extend({}, defaults, options);
		var box = $(this);
		var body = box.find('.scroll-body');
		var requestID = '';
		var y = 0;
		var _t = 0;

		var obj = {
			ready: function(t) {
				if(t - _t > opts.speed) {

					body.css({
						transform: 'translateY(' + y + 'px)'
					});

					if(body.height() - box.height() + y <= 0) {
						y = 0;
					}
					y--;
					_t = t;
				}
				requestID = requestAnimationFrame(obj.ready);
			}
		};

		requestID = requestAnimationFrame(obj.ready);

		box.on('mouseenter', function() {
			//停止
			cancelAnimationFrame(requestID);
		}).on('mouseleave', function() {
			//开始
			requestID = requestAnimationFrame(obj.ready);
		});

	}

})(jQuery);